#pragma once

#include <vector>

class Camera;
class Body;
class Render;

class Viewer {
public:
	virtual void Update(cv::Mat& image) {};
	void AddViewer(Viewer* child);

protected:
	std::vector<std::shared_ptr<Viewer>> child_views_;
};

class RootViewer : public Viewer {
public:
	static RootViewer* Build(const std::string& name, ImageWriter* writer);
	void UpdateViewer();

private:
	std::string name_;
	std::unique_ptr<ImageWriter> writer_;
};

class ImageViewer: public Viewer {
public:
	static ImageViewer* Build(Camera* cam);
	void Update(cv::Mat& image) override;

	Camera* cam_;
};

class NormalViewer: public Viewer {
public:
	static NormalViewer* Build(Render* render_ptr);
	void Update(cv::Mat& image) override;

	Render* render_ptr;
};

class AxisViewer : public Viewer {
public:
	static AxisViewer* Build(Camera* camera, Body* body);
	void DrawAxes(cv::Mat& image);
	void Update(cv::Mat& image) override;

	Camera* camera_ptr;
	Body* body_ptr;
};